<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<style type="text/css">
	body{overflow:auto;}
  thead tr {background-color: ActiveCaption; color: CaptionText;}
  th, td {vertical-align: top; font-family: "宋体", Arial, Helvetica, sans-serif; font-size: 9pt; padding: 3px; }
  table, td {border: 1px solid silver;}
  table {border-collapse: collapse;}
  thead .col0 {width: 20%;}
  thead .col1 {width: 75%;}
	td.col0{font-size:18px;font-weight:bold;color:#f00;}
</style>
<body class="white-bg">
    <table>
      <thead>
        <tr>
          <th class="col0">章节</th>
          <th class="col1">内容</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td class="col0">3.8 新闻管理</td>
          <td class="col1"><span style="font-family: 宋体; text-align: justify; text-indent: 28px;"><span style="font-size:18px;">俗话说“万事开头难”，当运用调试方法使前面的简单项目运行正常、功能正常以后，会 更顺利地完成项目的其他功能。</span></span><br />  </td>
        </tr>
        <tr>
          <td class="col0">3.8.1 后台Layout</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">网页布局是网站前端设计的重中之重，如何把文字、图片等网页元素有规则地排列在网 页中，达到良好的视觉效果，是网页布局要考虑的重要方面。网站选择什么样的布局直接影响 到访客在浏览器上看到的整体效果，页面设计得好与不好，直接影响到访客在网站的停留时间 长短。</p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 16.24px; text-align: justify;">好的网页布局不仅具有好的页面效果，而且能够让前端开发人员更好地把握网页的整体 结构，提高代码的书写效率，具有复用性和可维护性。</p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">网页布局有很多种，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">EasyUI&nbsp;</span>提供的布局是比较通用的布局模式，通过组合可以演变成很 多种流行的布局形式。如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-31&nbsp;</span>所示，<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">EasyUI&nbsp;</span>布局（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Layout</span>）是有五个区域（北区&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">North</span>、 南区&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">South</span>、东区&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">East</span>、西区&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">West&nbsp;</span>和中区&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Center</span>）的容器。中间的区域面板是必需的，边 缘区域面板是可选的。每个边缘区域面板可通过拖拽边框调整尺寸，也可以通过单击折叠触发 器来折叠面板。布局（<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Layout</span>）可以嵌套，因此用户可建立复杂的布局。</p><p style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 72pt; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_051.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 5pt 0px 0px 4pt; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-31 EasyUI&nbsp;</span>布局（<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">Layout</span>）</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 15.26px; text-align: justify;">修改前面创建的简单后台管理页&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">admin.html</span>，添加&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">EasyUI&nbsp;</span>布局&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Layout&nbsp;</span>和&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">EasyUI Tabs&nbsp;</span>选 项卡。</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 15.26px; text-align: justify;"></p><p><span style="font-family:宋体;">如图</span>3-32<span style="font-family:宋体;">所示，在后台管理页面使用默认布局中的</span>4<span style="font-family:宋体;">个区域（</span>north<span style="font-family:宋体;">、</span>west<span style="font-family:宋体;">、</span>south<span style="font-family:宋体;">和</span>center<span style="font-family:宋体;">），暂时没有使用</span>east<span style="font-family:宋体;">区域，分别在不同的区域，放置不同类型的内容。通用的做法是</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span><strong>north</strong><span style="font-family:宋体;">区域放置系统</span>logo<span style="font-family:宋体;">、已登录用户的名称、退出按钮或链接</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span><strong>west</strong><span style="font-family:宋体;">区域加载树形菜单</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span><strong>south</strong><span style="font-family:宋体;">区域显示版权信息</span></p><p><span style="font-family:Wingdings;">l<span style="font-size:7pt;font-family:'Times New Roman';">&nbsp; </span></span><strong>center</strong><span style="font-family:宋体;">区域使用tab来展示内容窗口</span></p><br /><div style="margin:0 auto;width: 900px;"><table cellspacing="0" style="margin: 0px 0px 0px 48.45pt; padding: 0px; vertical-align: top; overflow: visible; font-family: microsoft yahei; font-size:16px" border-collapse:="" collapse=""><tbody style="margin: 0px; padding: 0px; vertical-align: top; overflow: visible;"><tr style="margin: 0px; padding: 0px; height: 33pt;"><td colspan="2" style="margin: 0px; padding: 0px; width: 330pt; border-style: solid; border-width: 1pt; background-color: rgb(13, 195, 224);"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px; font-family: times new roman serif; font-size: 9pt" text-align:="" center="">North</p><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px; font-family: 宋体; font-size: 9pt; text-align: center;">系统&nbsp;<span class="s17" style="margin: 0px; padding: 0px; font-family: times new roman serif; font-size: 9pt">logo</span>、登录用户的名称、“退出”按钮或链接</p></td></tr><tr style="margin: 0px; padding: 0px; height: 74pt;"><td bgcolor="#000000" style="margin: 0px; padding: 0px; width: 66pt; border-style: solid; border-width: 1pt;"><p style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p class="s30" style="margin: 0pt; padding: 0px; color: rgb(255, 255, 255); font-family: times new roman serif; font-size: 9pt" text-align:="" center="">West</p><p class="s31" style="margin: 0pt; padding: 3pt 0px 0px; color: rgb(255, 255, 255); font-family: 宋体; font-size: 9pt; text-align: center;">树形菜单</p></td><td style="margin: 0px; padding: 0px; width: 264pt; border-style: solid; border-width: 1pt;"><p style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p class="s17" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt" text-align:="" center="">Center</p><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px; font-family: 宋体; font-size: 9pt; text-align: center;">内容主窗口</p></td></tr><tr style="margin: 0px; padding: 0px; height: 33pt;"><td colspan="2" bgcolor="#DFDFDF" style="margin: 0px; padding: 0px; width: 330pt; border-style: solid; border-width: 1pt;"><p class="s17" style="margin: 0pt; padding: 3pt 0px 0px; font-family: times new roman serif; font-size: 9pt" text-align:="" center="">South</p><p class="s18" style="margin: 0pt; padding: 3pt 0px 0px; font-family: 宋体; font-size: 9pt; text-align: center;">版权信息</p></td></tr></tbody></table></div><p style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p class="s9" style="margin: 0pt; padding: 2pt 0px 0px 22pt; text-indent: 141pt; font-family: 宋体; font-size: 9pt;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; text-indent: 0px; font-family: times new roman serif; font-size: 9pt">3-32&nbsp;</span>后台布局示意图</p><p class="s5" style="margin: 0pt; padding: 7pt 0px 0px 4pt; font-family: 宋体; font-size: 18px; text-align: center;"><br /></p><p style="margin: 0pt; padding: 4pt 0px 0px 9pt; font-family: times new roman serif; font-size: 9pt" text-align:="" center=""></p><p><span style="font-family:宋体;"><span style="font-size:18px;">实现上述布局的代码可以是：</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&lt;<strong>body</strong> class=</span><span style="color:#880000;">&quot;easyui-layout&quot;</span><span style="color:#444444;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>div</strong>data-options=</span><span style="color:#880000;">&quot;region:'north',border:false&quot;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; style=</span><span style="color:#880000;">&quot;background:#B3DFDA;padding:0 10px 010px;vertical-align: middle;&quot;</span><span style="color:#444444;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>img</strong>src=</span><span style="color:#880000;">&quot;$</span><span style="color:#BC6060;">{ctxPath}</span><span style="color:#880000;">/include/img/logo.png&quot;</span><span style="color:#444444;"> width=</span><span style="color:#880000;">&quot;126&quot;</span><span style="color:#444444;"> height=</span><span style="color:#880000;">&quot;50&quot;</span><span style="color:#444444;">/&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>div</strong>style=</span><span style="color:#880000;">&quot;float:right;line-height:50px;margin-right:10px;&quot;</span><span style="color:#444444;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;a id=&quot;logout&quot;href=&quot;#&quot; class=&quot;easyui-linkbutton&quot;data-options=&quot;iconCls:'icon-cancel'&quot;&gt;</span><span style="font-family:宋体;color:#444444;">退出</span><span style="color:#444444;">&lt;/a&gt;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<strong>div</strong>&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>div</strong>style=</span><span style="color:#880000;">&quot;float:right;line-height:50px;margin-right:10px;&quot;</span><span style="color:#444444;">&gt;</span><span style="font-family:宋体;color:#444444;">登录用户：</span><span style="color:#444444;">$</span><span style="color:#BC6060;">{me.xm}</span><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&lt;/<strong>div</strong>&gt;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<strong>div</strong>&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>div</strong> data-options=</span><span style="color:#880000;">&quot;region:'west',split:true,title:'</span><span style="font-family:宋体;color:#880000;">系统菜单</span><span style="color:#880000;">'&quot;</span><span style="color:#444444;"> style=</span><span style="color:#880000;">&quot;width:180px;padding:10px;&quot;</span><span style="color:#444444;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>ul</strong>id=</span><span style="color:#880000;">&quot;menutree&quot;</span><span style="color:#444444;"> class=</span><span style="color:#880000;">&quot;easyui-tree&quot;</span><span style="color:#444444;">&gt;&lt;/<strong>ul</strong>&gt;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<strong>div</strong>&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>div</strong> data-options=</span><span style="color:#880000;">&quot;region:'south',border:false&quot;</span><span style="color:#444444;"> style=</span><span style="color:#880000;">&quot;height:30px;padding:5px; text-align:center; font-family:arial;color: #A0B1BB;&quot;</span><span style="color:#444444;">&gt;Copyright&copy; 2017 JavaEE. All Rights Reserved.</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<strong>div</strong>&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>div</strong>data-options=</span><span style="color:#880000;">&quot;region:'center'&quot;</span><span style="color:#444444;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<strong>div</strong>id=</span><span style="color:#880000;">&quot;tabs&quot;</span><span style="color:#444444;"> class=</span><span style="color:#880000;">&quot;easyui-tabs&quot;</span><span style="color:#444444;"> fit=</span><span style="color:#880000;">&quot;true&quot;</span><span style="color:#444444;"> border=</span><span style="color:#880000;">&quot;false&quot;</span><span style="color:#444444;">&gt;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<strong>div</strong>&gt;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<strong>div</strong>&gt;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&lt;/<strong>body</strong>&gt;</span></span></p><br />  </td>
        </tr>
        <tr>
          <td class="col0">3.8.2 Tab 操作</td>
          <td class="col1"><p class="s6" style="margin: 0pt; padding: 9pt 0px 0px 22pt; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Tab&nbsp;<span class="s5" style="margin: 0px; padding: 0px; font-family: 宋体; font-size: 18px;">选项卡用于在固定大小的区域显示多个选项卡，通过切换选项卡可以看到每个选项卡</span><span style="font-family: 宋体; font-size: 18px;">呈现的不同内容。图&nbsp;</span><span class="s6" style="font-size: 18px; margin: 0px; padding: 0px;">3-33&nbsp;</span><span style="font-family: 宋体; font-size: 18px;">所示是&nbsp;</span><span class="s6" style="font-size: 18px; margin: 0px; padding: 0px;">Easyui&nbsp;</span><span style="font-family: 宋体; font-size: 18px;">提供的&nbsp;</span><span class="s6" style="font-size: 18px; margin: 0px; padding: 0px;">Tab&nbsp;</span><span style="font-family: 宋体; font-size: 18px;">控件。</span></p><p class="s5" style="margin: 0pt; padding: 1pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px; text-align: justify;">为了能够在布局的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Center&nbsp;</span>区域，根据所选菜单栏目，动态加载不同的相应内容，在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">include\js\</span>中创建&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">lrwtab.js&nbsp;</span>文件，在文件中自定义三个&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">js&nbsp;</span>函数，实现关闭所有&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Tab</span>、切换&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Tab</span>、 添加&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">Tab&nbsp;</span>的功能，然后在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">admin.html&nbsp;</span>页面中引用&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">lrwtab.js&nbsp;</span>文件。</p><p style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 103pt; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_052.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p class="s6" style="margin: 0pt; padding: 9pt 0px 0px 26pt; font-family: " times="" new="" roman="" serif="" font-size:="" 18px=""></p><p><span style="font-size:18px;">1. <span style="font-family:楷体_GB2312;">关闭所有</span>tab</span></p><p><span style="font-size:18px;">closeAllTabs<span style="font-family:宋体;">函数首先获取所有的</span>tab<span style="font-family:宋体;">，然后逐个关闭。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#444444;">function&nbsp;</span><span style="color:#880000;">closeAllTabs</span></strong><span style="color:#444444;">(){</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>var</strong>tabs=$(</span><span style="color:#880000;">&quot;#tabs&quot;</span><span style="color:#444444;">).tabs(</span><span style="color:#880000;">&quot;tabs&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>for</strong>(<strong>var</strong>i=</span><span style="color:#880000;">0</span><span style="color:#444444;">;i&lt;tabs.length;i++){</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(</span><span style="color:#880000;">&quot;#tabs&quot;</span><span style="color:#444444;">).tabs(</span><span style="color:#880000;">&quot;close&quot;</span><span style="color:#444444;">,i);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">}</span></span></p><p><span style="font-size:18px;">2. <span style="font-family:楷体_GB2312;">切换</span>tab</span></p><p><span style="font-size:18px;">swNewTab<span style="font-family:宋体;">函数，首先判断要切换的</span>tab<span style="font-family:宋体;">是否已经存在，如果存在则保持不变，否则关闭所有</span>tab<span style="font-family:宋体;">，再添加一个新</span>tab<span style="font-family:宋体;">，标题名称为</span>newtitle<span style="font-family:宋体;">，将</span>newurl<span style="font-family:宋体;">请求的页面，以</span>iframe<span style="font-family:宋体;">形式嵌入内容窗口。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#444444;">function&nbsp;</span><span style="color:#880000;">swNewTab</span></strong><span style="color:#444444;">(newtitle,newurl){</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong>($(</span><span style="color:#880000;">'#tabs'</span><span style="color:#444444;">).tabs(</span><span style="color:#880000;">'exists'</span><span style="color:#444444;">,newtitle))<strong>return</strong>;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; closeAllTabs();</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; $(</span><span style="color:#880000;">'#tabs'</span><span style="color:#444444;">).tabs(</span><span style="color:#880000;">'add'</span><span style="color:#444444;">,{</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; title:newtitle,</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content:</span><span style="color:#880000;">'&lt;iframe id=&quot;mainframe&quot;name=&quot;mainframe&quot; scrolling=&quot;auto&quot; height=&quot;99%&quot;width=&quot;99%&quot; frameboder=&quot;0&quot; src=&quot;'</span><span style="color:#444444;">+newurl+</span><span style="color:#880000;">'&quot;&gt;&lt;/iframe&gt;'</span><span style="color:#444444;">,</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; closable:</span><span style="color:#78A960;">true</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">}</span></span></p><p><span style="font-size:18px;">3. <span style="font-family:楷体_GB2312;">添加</span>tab</span></p><p><span style="font-size:18px;">addNewTab<span style="font-family:宋体;">函数，首先判断要切换的</span>tab<span style="font-family:宋体;">是否已经存在，如果存在则保持不变，否则添加一个新</span>tab<span style="font-family:宋体;">，标题名称为</span>newtitle<span style="font-family:宋体;">，将</span>newurl<span style="font-family:宋体;">请求的页面，以</span>iframe<span style="font-family:宋体;">形式嵌入内容窗口。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#444444;">function&nbsp;</span><span style="color:#880000;">addNewTab</span></strong><span style="color:#444444;">(newtitle,newurl){</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong>($(</span><span style="color:#880000;">'#tabs'</span><span style="color:#444444;">).tabs(</span><span style="color:#880000;">'exists'</span><span style="color:#444444;">,newtitle))<strong>return</strong>;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; $(</span><span style="color:#880000;">'#tabs'</span><span style="color:#444444;">).tabs(</span><span style="color:#880000;">'add'</span><span style="color:#444444;">,{</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; title:newtitle,</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; content:</span><span style="color:#880000;">'&lt;iframe id=&quot;mainframe&quot;name=&quot;mainframe&quot; scrolling=&quot;auto&quot; height=&quot;99%&quot;width=&quot;99%&quot; frameboder=&quot;0&quot; src=&quot;'</span><span style="color:#444444;">+newurl+</span><span style="color:#880000;">'&quot;&gt;&lt;/iframe&gt;'</span><span style="color:#444444;">,</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; closable:</span><span style="color:#78A960;">true</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">}</span></span></p><br />  </td>
        </tr>
        <tr>
          <td class="col0">3.8.3 封装Tree型数据</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>cn.lrw.newsnutz.pojo<span style="font-family:宋体;">中创建</span>EasyUITree<span style="font-family:宋体;">类，根据</span>easyUI<span style="font-family:宋体;">中</span>Tree<span style="font-family:宋体;">控件的属性，设置</span>easyUITree<span style="font-family:宋体;">对象的属性。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#444444;">public</span></strong><span style="color:#444444;"> <strong>class</strong> </span><strong><span style="color:#880000;">EasyUITree</span></strong><span style="color:#444444;">{</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>private</strong>String id;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>private</strong>String text;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>private</strong>Boolean checked = <strong>false</strong>;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>private</strong>Map&lt;String,Object&gt; attributes;</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>private</strong>String state = </span><span style="color:#880000;">&quot;closed&quot;</span><span style="color:#444444;">;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>public</strong>List&lt;EasyUITree&gt; children;&nbsp;&nbsp;&nbsp; </span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#888888;">//</span><span style="font-family:宋体;color:#888888;">省略了部分</span><span style="color:#888888;">getter/setter</span><span style="font-family:宋体;color:#888888;">方法</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>public</strong>List&lt;EasyUITree&gt; </span><strong><span style="color:#880000;">getChildren</span></strong><span style="color:#444444;">() {</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>return</strong>children;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp; <strong>publicvoid</strong> </span><strong><span style="color:#880000;">setChildren</span></strong><span style="color:#444444;">(List&lt;EasyUITree&gt; children) {</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>this</strong>.children= children;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; } </span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">}</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>cn.lrw.newsnutz.utils<span style="font-family:宋体;">中创建</span>MenuTree<span style="font-family:宋体;">类，添加</span>menutree<span style="font-family:宋体;">方法，该方法是从数据库的</span>cmenu<span style="font-family:宋体;">表中取出菜单栏目数据，然后封装成</span>json <span style="font-family:宋体;">格式的</span>EasyUITree<span style="font-family:宋体;">数据。如果登录的用户角色不在菜单的</span>permission<span style="font-family:宋体;">中，则不会封装到返回数据中，用户在前端页面也就看不到该菜单栏目。在当前项目中，菜单栏目已适当简化，层级只有</span>2<span style="font-family:宋体;">级、栏目的顺序不能动态调整。实现</span>menutree<span style="font-family:宋体;">方法的代码如下：</span></span></p><p><span style="color:#1F7199;"><span style="font-size:18px;">@At</span></span></p><p><span style="font-size:18px;"><span style="color:#1F7199;">@Ok</span><span style="color:#444444;">(</span><span style="color:#880000;">&quot;raw&quot;</span><span style="color:#444444;">)</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;"> <strong>public</strong> String </span><strong><span style="color:#880000;">menutree</span></strong><span style="color:#444444;">(HttpServletRequest req, HttpSession session){</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; User user = (User) session.getAttribute(</span><span style="color:#880000;">&quot;me&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String role=user.getRole();</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#888888;">//</span><span style="font-family:宋体;color:#888888;">父级菜单</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;Cmenu&gt; menulist=dao.query(Cmenu.class,Cnd.where(</span><span style="color:#880000;">&quot;pid&quot;</span><span style="color:#444444;">,</span><span style="color:#880000;">&quot;=&quot;</span><span style="color:#444444;">,</span><span style="color:#880000;">0</span><span style="color:#444444;">).asc(</span><span style="color:#880000;">&quot;id&quot;</span><span style="color:#444444;">));</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;EasyUITree&gt; eList = <strong>new</strong>ArrayList&lt;EasyUITree&gt;();</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong>(menulist.size() != </span><span style="color:#880000;">0</span><span style="color:#444444;">){</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>for</strong> (<strong>int</strong> i = </span><span style="color:#880000;">0</span><span style="color:#444444;">;i &lt; menulist.size(); i++) {</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cmenu t = menulist.get(i);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong>(!t.getPermission().contains(role))<strong>continue</strong>;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EasyUITree e = <strong>new</strong> EasyUITree();</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.setId(t.getId());</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.setText(t.getName());</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;EasyUITree&gt; eList2 = <strong>new</strong>ArrayList&lt;EasyUITree&gt;();</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;Cmenu&gt; menu2 =dao.query(Cmenu.class, Cnd.where(</span><span style="color:#880000;">&quot;pid&quot;</span><span style="color:#444444;">, </span><span style="color:#880000;">&quot;=&quot;</span><span style="color:#444444;">, t.getId()).asc(</span><span style="color:#880000;">&quot;id&quot;</span><span style="color:#444444;">));</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>for</strong> (<strong>int</strong> j = </span><span style="color:#880000;">0</span><span style="color:#444444;">;j &lt; menu2.size(); j++) {</span><span style="color:#888888;">//</span><span style="font-family:宋体;color:#888888;">二级菜单</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Cmenu t2 = menu2.get(j);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong>(!t2.getPermission().contains(role))<strong>continue</strong>;</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map&lt;String,Object&gt;attributes = <strong>new</strong> HashMap&lt;String, Object&gt;();</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attributes.put(</span><span style="color:#880000;">&quot;url&quot;</span><span style="color:#444444;">, t2.getUrl());</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; attributes.put(</span><span style="color:#880000;">&quot;role&quot;</span><span style="color:#444444;">, t2.getPermission());</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EasyUITree e1 = <strong>new</strong>EasyUITree();</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e1.setAttributes(attributes);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e1.setId(t2.getId()+</span><span style="color:#880000;">&quot;&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e1.setText(t2.getName());</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e1.setState(</span><span style="color:#880000;">&quot;open&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eList2.add(e1);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.setChildren(eList2);</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; e.setState(</span><span style="color:#880000;">&quot;closed&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eList.add(e);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>return</strong> Json.toJson(eList);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;"> }</span></span></p><p><span style="color:#444444;background:#F0F0F0;"><span style="font-size:18px;">&nbsp;</span></span></p></td>
        </tr>
        <tr>
          <td class="col0">3.8.4 加载Tree型菜单栏目</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;"></p><p><span style="font-family:宋体;">使用以下代码中的</span>$(“#menutree”).tree()<span style="font-family:宋体;">，在网页左侧</span>(west)<span style="font-family:宋体;">动态加载树形菜单，菜单数据来源于后台以</span>json<span style="font-family:宋体;">形式封装的层级菜单数据。</span></p><p><span style="font-family:宋体;">如果点击一个菜单项，则在</span>tab<span style="font-family:宋体;">中打开相应的页面</span>swNewTab(node.text,“${ctxPath}”+node.attributes.url)<span style="font-family:宋体;">，并在标签上面显示相应的名称</span>node.text<span style="font-family:宋体;">；</span></p><p><span style="font-family:宋体;">如果点击一个父级菜单，则折叠</span>collapse<span style="font-family:宋体;">其它打开的父级菜单，然后展开</span>expand<span style="font-family:宋体;">当前点击的父级菜单，显示其下属的二级菜单项。</span></p><p><span style="color:#444444;">var opened_node;</span></p><p><span style="color:#444444;">$(</span><span style="color:#880000;">&quot;#menutree&quot;</span><span style="color:#444444;">).tree(</span></p><p><span style="color:#444444;">{</span></p><p><span style="color:#444444;"> url : </span><span style="color:#880000;">&quot;${ctxPath}/menutree&quot;</span><span style="color:#444444;">,</span></p><p><span style="color:#444444;"> animate : </span><span style="color:#78A960;">true</span><span style="color:#444444;">,</span></p><p><span style="color:#444444;"> onClick : <strong>function</strong>(node) {</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong> (!node.attributes) {</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong>if</strong> (!opened_node) {</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;$(</span><span style="color:#880000;">&quot;#menutree&quot;</span><span style="color:#444444;">).tree(</span><span style="color:#880000;">'expand'</span><span style="color:#444444;">,node.target);</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;opened_node = node.target;</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <strong>elseif</strong> (opened_node != node.target) {</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;$(</span><span style="color:#880000;">&quot;#menutree&quot;</span><span style="color:#444444;">).tree(</span><span style="color:#880000;">'collapse'</span><span style="color:#444444;">,opened_node);</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;$(</span><span style="color:#880000;">&quot;#menutree&quot;</span><span style="color:#444444;">).tree(</span><span style="color:#880000;">'expand'</span><span style="color:#444444;">,node.target);</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;opened_node = node.target;</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } <strong>else</strong> {</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; swNewTab(node.text,</span><span style="color:#880000;">&quot;${ctxPath}&quot;</span><span style="color:#444444;"> +node.attributes.url);</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="color:#444444;"> },</span></p><p><span style="color:#444444;"> onLoadSuccess : <strong>function</strong>(node, data) {</span></p><p><span style="color:#444444;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(</span><span style="color:#880000;">&quot;#menutree&quot;</span><span style="color:#444444;">).tree(</span><span style="color:#880000;">'expandAll'</span><span style="color:#444444;">);</span></p><p><span style="color:#444444;"> }</span></p><p><span style="color:#444444;">});</span></p><p>&nbsp;</p><br /><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;"><br /></p><p class="s5" style="margin: 0pt; padding: 0px 0px 0px 26pt; font-family: 宋体; font-size: 18px;">运行项目，登录后台查看，是否在布局左边正常显示菜单栏目，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; font-family: " times="" new="" roman="" serif="" font-size:="" 18px="">3-34&nbsp;</span>所示。</p><p style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 45pt; font-family: times new roman serif; font-size: 9pt" line-height:="" 10pt="" text-align:="" center=""><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_053.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 47pt; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: times new roman serif; font-size: 9pt">3-34 Tree&nbsp;</span>型菜单</p>  </td>
        </tr>
        <tr>
          <td class="col0">3.8.5 后端新闻业务逻辑</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>cn.lrw.newsnutz.module<span style="font-family:宋体;">包中，创建新闻信息的业务逻辑处理类</span>NewsAct<span style="font-family:宋体;">，可能要用到公有方法，则继承</span>BaseAct<span style="font-family:宋体;">类；在类名前添加注解</span>@IocBean<span style="font-family:宋体;">、类的入口注解</span>@At(“/news”)<span style="font-family:宋体;">、登录过滤器</span>@Filters({@By(type=LoginFilter.class)})<span style="font-family:宋体;">，注入</span>dao<span style="font-family:宋体;">对象，添加对新闻的增删改查业务处理方法。</span></span></p><p><span style="color:#646464;"><span style="font-size:18px;">@IocBean</span></span></p><p><span style="font-size:18px;"><span style="color:#646464;">@At</span>(<span style="color:#2A00FF;">&quot;/news&quot;</span>)</span></p><p><span style="font-size:18px;"><span style="color:#646464;">@Filters</span>({<span style="color:#646464;">@By</span>(type=LoginFilter.<strong><span style="color:#7F0055;">class</span></strong>)})</span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">class</span></strong>NewsAct <strong><span style="color:#7F0055;">extends</span></strong> BaseAct {</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Inject</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">protected</span></strong> Dao <span style="color:#0000C0;">dao</span>;</span></p><p><span style="font-family:宋体;"><span style="font-size:18px;">注意：</span></span></p><p><span style="font-size:18px;">(1)<span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">提交新闻的日期时间在服务器生成，避免由于客户端的设备时间有误带来日期时间的不一致性。</span></span></p><p><span style="font-size:18px;">(2)<span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">只要用户请求阅读一条新闻，则将该新闻的阅读量增加</span>1<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;">1. <span style="font-family:楷体_GB2312;">添加新闻</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>1<span style="font-family:宋体;">）请求跳转到添加新闻的页面</span>newsadd.html<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;beetl:web/newsadd.html&quot;</span>)</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">void</span></strong> goAdd(HttpSession <span style="color:#6A3E3E;">session</span>,HttpServletRequest <span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>2<span style="font-family:宋体;">）保存新闻。接收用户在前端页面</span>newsadd.html<span style="font-family:宋体;">添加的新闻信息，</span><a href="mailto:%E5%8F%82%E6%95%B0@Param(%22..%22)"><span style="font-family:宋体;">参数</span>@Param(&quot;..&quot;)</a><span style="font-family:宋体;">中的</span>”..”<span style="font-family:宋体;">表示对象，</span><span style="font-family:宋体;">补充发布时间和阅读量（默认为</span>0<span style="font-family:宋体;">），然后保存到数据库。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;raw&quot;</span>)</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span></strong> String saveAdd(<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;..&quot;</span>)News<span style="color:#6A3E3E;">news</span>,HttpSession <span style="color:#6A3E3E;">session</span>,HttpServletRequest<span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">try</span></strong>{</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">news</span>.setTjdate(<strong><span style="color:#7F0055;">new</span></strong> Date());</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">news</span>.setHitnum(0);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#0000C0;">dao</span>.insert(<span style="color:#6A3E3E;">news</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<strong><span style="color:#7F0055;">catch</span></strong>(Exception<span style="color:#6A3E3E;">e</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">e</span>.printStackTrace();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return</span></strong><span style="color:#2A00FF;">&quot;</span><span style="font-family:宋体;color:#2A00FF;">添加失败</span><span style="color:#2A00FF;">&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return</span></strong> <span style="color:#2A00FF;">&quot;true&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">2. <span style="font-family:楷体_GB2312;">删除新闻</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">删除指定</span>id<span style="font-family:宋体;">的一条新闻。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;raw&quot;</span>)</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span></strong> String doDel1(<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;id&quot;</span>)<strong><span style="color:#7F0055;">int</span></strong> <span style="color:#6A3E3E;">id</span>,HttpSession<span style="color:#6A3E3E;">session</span>,HttpServletRequest <span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(<span style="color:#0000C0;">dao</span>.delete(News.<strong><span style="color:#7F0055;">class</span></strong>,<span style="color:#6A3E3E;">id</span>)&gt;0)<strong><span style="color:#7F0055;">return</span></strong><span style="color:#2A00FF;">&quot;true&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return</span></strong> <span style="color:#2A00FF;">&quot;false&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">3. <span style="font-family:楷体_GB2312;">修改新闻</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>1<span style="font-family:宋体;">）请求跳转到修改新闻的页面</span>newsedit.html<span style="font-family:宋体;">，同时从数据库获取指定</span>id<span style="font-family:宋体;">的新闻信息，通过</span>request<span style="font-family:宋体;">带回前端页面。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;beetl:web/newsedit.html&quot;</span>)</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">void</span></strong> goEdit(<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;id&quot;</span>)<strong><span style="color:#7F0055;">int</span></strong><span style="color:#6A3E3E;">id</span>,HttpSession <span style="color:#6A3E3E;">session</span>,HttpServletRequest<span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; News <span style="color:#6A3E3E;">news</span>=<span style="color:#0000C0;">dao</span>.fetch(News.<strong><span style="color:#7F0055;">class</span></strong>,<span style="color:#6A3E3E;">id</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">req</span>.setAttribute(<span style="color:#2A00FF;">&quot;news&quot;</span>, <span style="color:#6A3E3E;">news</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>2<span style="font-family:宋体;">）保存修改后的新闻。接收用户在前端页面</span>newsedit.html<span style="font-family:宋体;">修改的新闻信息，更新到数据库。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;raw&quot;</span>)</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span></strong> StringsaveEdit(<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;..&quot;</span>)News<span style="color:#6A3E3E;">news</span>,HttpSession <span style="color:#6A3E3E;">session</span>,HttpServletRequest<span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">try</span></strong>{</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">news</span>.setTjdate(<strong><span style="color:#7F0055;">null</span></strong>);<span style="color:#3F7F5F;">//</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(<span style="color:#0000C0;">dao</span>.updateIgnoreNull(<span style="color:#6A3E3E;">news</span>)==1)<strong><span style="color:#7F0055;">return</span></strong> <span style="color:#2A00FF;">&quot;true&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">else</span><span style="color:#7F0055;">return</span></strong> <span style="color:#2A00FF;">&quot;</span><span style="font-family:宋体;color:#2A00FF;">修改失败</span><span style="color:#2A00FF;">&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<strong><span style="color:#7F0055;">catch</span></strong>(Exception<span style="color:#6A3E3E;">e</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">e</span>.printStackTrace();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return</span></strong><span style="color:#2A00FF;">&quot;</span><span style="font-family:宋体;color:#2A00FF;">修改失败</span><span style="color:#2A00FF;">&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">4. <span style="font-family:楷体_GB2312;">查询新闻</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">如果允许没有登录后台的用户查看新闻，需要在相应方法前面添加注解</span>@Filters()<span style="font-family:宋体;">，暂时屏蔽类前的</span>LoginFilter<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;raw&quot;</span>)<span style="color:#3F7F5F;">//</span><span style="font-family:宋体;color:#3F7F5F;">新闻数量</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Filters</span>()</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">int</span></strong> getCount(HttpSession <span style="color:#6A3E3E;">session</span>,HttpServletRequest <span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return</span></strong> <span style="color:#0000C0;">dao</span>.count(News.<strong><span style="color:#7F0055;">class</span></strong>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;beetl:web/newslist.html&quot;</span>)<span style="color:#3F7F5F;">//</span><span style="font-family:宋体;color:#3F7F5F;">跳转到新闻信息列表</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">void</span></strong> goList(HttpSession <span style="color:#6A3E3E;">session</span>, HttpServletRequest <span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;beetl:web/newsread.html&quot;</span>)<span style="color:#3F7F5F;">//</span><span style="font-family:宋体;color:#3F7F5F;">阅读指定</span><span style="color:#3F7F5F;">id</span><span style="font-family:宋体;color:#3F7F5F;">的新闻内容</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Filters</span>()</span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">void</span></strong>getNews(<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;id&quot;</span>)<strong><span style="color:#7F0055;">int</span></strong> <span style="color:#6A3E3E;">id</span>,HttpSession<span style="color:#6A3E3E;">session</span>,HttpServletRequest <span style="color:#6A3E3E;">req</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; News <span style="color:#6A3E3E;">news</span> = <span style="color:#0000C0;">dao</span>.fetch(News.<strong><span style="color:#7F0055;">class</span></strong>,<span style="color:#6A3E3E;">id</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">int</span></strong> <span style="color:#6A3E3E;">hitnum</span>=<span style="color:#6A3E3E;">news</span>.getHitnum()+1;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">news</span>.setHitnum(<span style="color:#6A3E3E;">hitnum</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#0000C0;">dao</span>.updateIgnoreNull(<span style="color:#6A3E3E;">news</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">req</span>.setAttribute(<span style="color:#2A00FF;">&quot;news&quot;</span>, <span style="color:#6A3E3E;">news</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="color:#646464;"><span style="font-size:18px;">@At</span></span></p><p><span style="font-size:18px;"><span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;raw&quot;</span>)<span style="color:#3F7F5F;">//</span><span style="font-family:宋体;color:#3F7F5F;">分页查询指定新闻或所有新闻</span></span></p><p><span style="font-size:18px;"><span style="color:#646464;">@Filters</span>()</span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;">public</span></strong> String listNews(<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;page&quot;</span>)<strong><span style="color:#7F0055;">int</span></strong> <span style="color:#6A3E3E;">curPage</span>,<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;rows&quot;</span>)<strong><span style="color:#7F0055;">int</span></strong> <span style="color:#6A3E3E;">pageSize</span>,<span style="color:#646464;">@Param</span>(<span style="color:#2A00FF;">&quot;s_name&quot;</span>)String <span style="color:#6A3E3E;">s_name</span>, HttpSession <span style="color:#6A3E3E;">session</span>) {</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; Criteria <span style="color:#6A3E3E;">cri</span> = Cnd.<em>cri</em>();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong> (!Strings.<em>isBlank</em>(<span style="color:#6A3E3E;">s_name</span>)) {</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">cri</span>.where().andLike(<span style="color:#2A00FF;">&quot;title&quot;</span>, <span style="color:#6A3E3E;">s_name</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">else</span></strong> <span style="color:#6A3E3E;">cri</span>.where().andEquals(<span style="color:#2A00FF;">&quot;1&quot;</span>,1);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">cri</span>.getOrderBy().desc(<span style="color:#2A00FF;">&quot;id&quot;</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return</span></strong> listPageJson(<span style="color:#0000C0;">dao</span>, News.<strong><span style="color:#7F0055;">class</span></strong>,<span style="color:#6A3E3E;">curPage</span>,<span style="color:#6A3E3E;">pageSize</span>,<span style="color:#6A3E3E;">cri</span>);</span></p><p><span style="font-size:18px;">}</span></p></td>
        </tr>
        <tr>
          <td class="col0">3.8.6 封装DataGrid数据</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">为了能让前端</span>easyuidatagrid<span style="font-family:宋体;">获取正确的数据，在</span>BaseAct<span style="font-family:宋体;">中添加</span>listPageJson<span style="font-family:宋体;">方法，从数据库按查询条件</span>cnd<span style="font-family:宋体;">获取数据后，再次封装成包含当前页码</span>curPage<span style="font-family:宋体;">、每页新闻数量</span>pageSize<span style="font-family:宋体;">、新闻列表</span>List&lt;News&gt;<span style="font-family:宋体;">等信息的</span>JSON<span style="font-family:宋体;">格式数据。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span></strong> &lt;T&gt;String listPageJson(Dao <span style="color:#6A3E3E;">dao</span>, Class&lt;T&gt; <span style="color:#6A3E3E;">obj</span>, <strong><span style="color:#7F0055;">int</span></strong><span style="color:#6A3E3E;">curPage</span>, <strong><span style="color:#7F0055;">int</span></strong><span style="color:#6A3E3E;">pageSize</span>, Condition <span style="color:#6A3E3E;">cnd</span>){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Map&lt;String, Object&gt; <span style="color:#6A3E3E;">jsonobj</span>= <strong><span style="color:#7F0055;">new</span></strong> HashMap&lt;String,Object&gt;();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Pager <span style="color:#6A3E3E;">pager</span> = <span style="color:#6A3E3E;">dao</span>.createPager(<span style="color:#6A3E3E;">curPage</span>,<span style="color:#6A3E3E;">pageSize</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; List&lt;T&gt; <span style="color:#6A3E3E;">list</span>= <span style="color:#6A3E3E;">dao</span>.query(<span style="color:#6A3E3E;">obj</span>,<span style="color:#6A3E3E;">cnd</span>, <span style="color:#6A3E3E;">pager</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">pager</span>.setRecordCount(<span style="color:#6A3E3E;">dao</span>.count(<span style="color:#6A3E3E;">obj</span>, <span style="color:#6A3E3E;">cnd</span>));</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">jsonobj</span>.put(<span style="color:#2A00FF;">&quot;total&quot;</span>, <span style="color:#6A3E3E;">pager</span>.getRecordCount());</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">jsonobj</span>.put(<span style="color:#2A00FF;">&quot;rows&quot;</span>, <span style="color:#6A3E3E;">list</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return</span></strong> Json.<em>toJson</em>(<span style="color:#6A3E3E;">jsonobj</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;</span></p></td>
        </tr>
        <tr>
          <td class="col0">3.8.7 后端文件上传</td>
          <td class="col1"><p><span style="font-family:宋体;"><span style="font-size:18px;">由于前端发布新闻时，可能需要上传文件，比如图片、附件，后端必须有相应的响应方法，实现上传的文件写到服务器上指定的文件夹中。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>cn.lrw.newsnutz.utils<span style="font-family:宋体;">中创建</span>FileAct<span style="font-family:宋体;">类，封装对上传文件数据的获取、生成新的文件名、按上传日期创建文件夹分类存储到服务器磁盘中。</span></span></p><p><span style="font-family:宋体;"><span style="font-size:18px;">拟采用<strong>百度编辑器</strong>，所以上传的文件存储到服务器上磁盘的方法，只针对这个编辑器，存储的具体位置由配置文件指定。其它在线编辑器，有相似的使用方法，可以参考百度编辑器，灵活使用。</span></span></p><p><span style="color:#646464;"><span style="font-size:18px;">@IocBean</span></span></p><p><span style="font-size:18px;"><span style="color:#646464;">@At</span>(<span style="color:#2A00FF;">&quot;/file&quot;</span>)</span></p><p><span style="font-size:18px;"><span style="color:#646464;">@Filters</span>({<span style="color:#646464;">@By</span>(type=LoginFilter.<strong><span style="color:#7F0055;">class</span></strong>)})</span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">class</span></strong>FileAct {</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@At</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#646464;">@Ok</span>(<span style="color:#2A00FF;">&quot;raw&quot;</span>)</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">public</span> <span style="color:#7F0055;">void</span></strong> bdupfile(HttpSession <span style="color:#6A3E3E;">session</span>,HttpServletRequest <span style="color:#6A3E3E;">req</span>,HttpServletResponse <span style="color:#6A3E3E;">res</span>)<strong><span style="color:#7F0055;">throws</span></strong> IOException{</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">req</span>.setCharacterEncoding(<span style="color:#2A00FF;">&quot;utf-8&quot;</span> );</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">res</span>.setHeader(<span style="color:#2A00FF;">&quot;Content-Type&quot;</span> , <span style="color:#2A00FF;">&quot;text/html&quot;</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String <span style="color:#6A3E3E;">rootPath</span> =Mvcs.<em>getServletContext</em>().getRealPath( <span style="color:#2A00FF;">&quot;/&quot;</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PrintWriter <span style="color:#6A3E3E;">out</span> = <span style="color:#6A3E3E;">res</span>.getWriter();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#6A3E3E;">out</span>.write( <strong><span style="color:#7F0055;">new</span></strong> ActionEnter( <span style="color:#6A3E3E;">req</span>,<span style="color:#6A3E3E;">rootPath</span> ).exec() );</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">}</span></p></td>
        </tr>
        <tr>
          <td class="col0">3.8.8 修改UEditorl.5</td>
          <td class="col1"><p class="s5" style="margin: 0pt; padding: 9pt 0px 0px 5pt; text-indent: 21pt; font-family: 宋体; font-size: 18px; line-height: 28px;">从官网下载&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">UEditor1.5.0&nbsp;</span>开发版源码。在&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">MyEclipse&nbsp;</span>中新建一个&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">Java Project</span>，假定命名为&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">ueditor1.5.0</span>，如图&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">3-35&nbsp;</span>所示。把&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">UEditor1.5.0&nbsp;</span>源码包中&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">jsp/src&nbsp;</span>里面的&nbsp;<span class="s6" style="margin: 0px; padding: 0px; text-indent: 0px; font-family: Times New Roman, serif; font-size: 18px;">package&nbsp;</span>包放进项目<span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">ueditor1.5.0&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">的&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">src&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">中，修改&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">com.baidu.ueditor&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">包中的&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">ConfigManager.java&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">文件，在它的&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">initEnv&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">方法中添加图&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">3-35&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">右侧所示框中的代码，这些代码影响配置文件&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">config.json&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">中上传文件的路 径。导出项目为&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">jar&nbsp;</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">文件，假定为&nbsp;</span><span style="font-family: Times New Roman, serif; font-size: 18px; text-align: justify;">ueditor1.5.0.jar</span><span class="s5" style="font-size: 18px; text-align: justify; margin: 0px; padding: 0px;">。</span></p><p style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;"><br style="margin: 0px; padding: 0px;" /></p><p style="margin: 0pt; padding: 0px 0px 0px 7pt; font-family: Times New Roman, serif; font-size: 9pt; line-height: 10pt; text-align: center;"><span style="margin: 0px; padding: 0px;"><img th:src="@{/assets/javaeeimg/Image_054.png}" style="margin: 0px; padding: 0px;" alt="" /></span></p><p class="s9" style="margin: 0pt; padding: 4pt 0px 0px 166pt; font-family: 宋体; font-size: 9pt; text-align: center;">图&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">3-35&nbsp;</span>修改&nbsp;<span class="p" style="margin: 0pt; padding: 0px; font-family: Times New Roman, serif; font-size: 9pt;">ueditor1.5.0</span></p> </td>
        </tr>
        <tr>
          <td class="col0">3.8.9 后台新闻信息处理</td>
          <td class="col1"><p class="s5" style="padding: 9pt 0px 0px 26pt; font-size: 18px;">实现后台添加、删除、修改和查询新闻信息的前端页面。</p></td>
        </tr>
        <tr>
          <td class="col0">1.后台新闻列表</td>
          <td class="col1"><p><span style="font-size:18px;">1. <span style="font-family:楷体_GB2312;">后台新闻列表</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>WebRoot\WEB-INF\web<span style="font-family:宋体;">中创建</span>newslist.html<span style="font-family:宋体;">页面，使用</span>datagrid<span style="font-family:宋体;">呈现新闻列表信息，在页面上可以查询新闻、可以请求跳转到修改新闻的页面、可以请求删除新闻，如图</span>3-36<span style="font-family:宋体;">、图</span>3-37<span style="font-family:宋体;">所示。引入的</span>js<span style="font-family:宋体;">和</span>css<span style="font-family:宋体;">样式文件，基本与</span>admin.html<span style="font-family:宋体;">相同，所以可以用复制页面、修改页面的方法，提高页面的创建效率。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_055.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-36<span style="font-family:宋体;">后台新闻列表</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_056.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-37<span style="font-family:宋体;">后台查询新闻</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">主要</span>html<span style="font-family:宋体;">代码，以</span>datagrid<span style="font-family:宋体;">呈现新闻列表、在其附属的工具栏中显示一个关键字输入框和一个查询按钮：</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">table</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;dg&quot;</span></em> <u><span style="color:#7F007F;">cellpadding</span></u>=<em><span style="color:#2A00FF;">&quot;2&quot;</span></em> <span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">table</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;tb&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">padding</span>:<em><span style="color:#2A00E1;">5px</span></em>;&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">input</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;s_name&quot;</span></em> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;easyui-textbox&quot;</span></em><span style="color:#7F007F;">data-options</span>=<em><span style="color:#2A00FF;">&quot;prompt:'</span><span style="font-family:宋体;color:#2A00FF;">标题关键字</span><span style="color:#2A00FF;">...'&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">200px</span></em>;<span style="color:#7F007F;">height</span>:<em><span style="color:#2A00E1;">32px</span></em>&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">a</span><span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;s_news&quot;</span></em><span style="color:#7F007F;">href</span>=<em><span style="color:#2A00FF;">&quot;#&quot;</span></em><span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;easyui-linkbutton&quot;</span></em><span style="color:#7F007F;">data-options</span>=<em><span style="color:#2A00FF;">&quot;iconCls:'icon-search'&quot;</span></em><span style="color:teal;">&gt;</span><span style="font-family:宋体;">查询</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">a</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">主要</span>js<span style="font-family:宋体;">代码如下，实现</span>datagrid<span style="font-family:宋体;">中新闻数据的动态分页加载，执行查询、删除和修改。需要注意以下几个方面：</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>1<span style="font-family:宋体;">）父级消息框。</span>js <span style="font-family:宋体;">代码用到形如</span>parent.$.messager <span style="font-family:宋体;">的写法，主要作用是弹出父级页面中的</span>easyui <span style="font-family:宋体;">消息框，不是当前页面</span>(iframe)<span style="font-family:宋体;">中的消息框。优势是，以模态窗口弹出的消息框遮挡整个页面（包括父级</span>layout <span style="font-family:宋体;">和当前</span>iframe<span style="font-family:宋体;">），用户只能操作弹出的消息框，不能操作页面上其它内容，这种使用方法在后面的开发过程中还会出现很多次。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>2<span style="font-family:宋体;">）长标题自动折断。当标题太长时，如果在一行全部显示，会破坏页面布局效果。所以希望标题太长时，自动根据显示宽度折断，但当鼠标移动到该标题上时，显示完整的标题内容，效果如图</span>3-38<span style="font-family:宋体;">所示。解决方案是，对于标题的显示特殊处理，一是修改样式，实现过长自动折断，修改</span>easyui.css<span style="font-family:宋体;">中</span>.datagrid-cell<span style="font-family:宋体;">样式，添加属性和值</span>text-overflow: ellipsis<span style="font-family:宋体;">，二是增加元素的</span>title<span style="font-family:宋体;">属性（</span><span style="background:white;">'&lt;spantitle='+ value+ '&gt;' + (value?value:'')+'&lt;/span&gt;'</span><span style="font-family:宋体;">），鼠标指针</span>hover<span style="font-family:宋体;">时，自动显示完整标题。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_057.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-38<span style="font-family:宋体;">长标题自动折断</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>3<span style="font-family:宋体;">）当焦点在</span>id<span style="font-family:宋体;">为</span>tb<span style="font-family:宋体;">的</span>div<span style="font-family:宋体;">元素中时，按下回车键，即进行查询</span><span style="background:white;">$(<span style="color:#2A00FF;">&quot;#tb&quot;</span>).bind(<span style="color:#2A00FF;">&quot;keydown&quot;</span>,<strong><span style="color:#7F0055;">function</span></strong>(e){</span>…})<span style="font-family:宋体;">；如果焦点</span>tb<span style="font-family:宋体;">以外，按下回车键不会执行查询操作。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">var </span></strong><span style="background:white;">s_name=<span style="color:#2A00FF;">&quot;&quot;</span>,id=<span style="color:#2A00FF;">&quot;&quot;</span>,title=<span style="color:#2A00FF;">&quot;&quot;</span>;</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">function </span></strong><span style="background:white;">loadGrid(){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; s_name=$(<span style="color:#2A00FF;">&quot;#s_name&quot;</span>).val();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#dg&quot;</span>).datagrid({</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; width:800,height:500,nowrap:<strong><span style="color:#7F0055;">false</span></strong>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; striped:<strong><span style="color:#7F0055;">true</span></strong>,border:<strong><span style="color:#7F0055;">true</span></strong>,collapsible:<strong><span style="color:#7F0055;">false</span></strong>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url:<span style="color:#2A00FF;">&quot;${ctxPath}/news/listNews&quot;</span>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; queryParams:{<span style="color:#2A00FF;">&quot;s_name&quot;</span>:s_name},</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pagination:<strong><span style="color:#7F0055;">true</span></strong>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rownumbers:<strong><span style="color:#7F0055;">true</span></strong>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fitColumns:<strong><span style="color:#7F0055;">true</span></strong>,pageSize:20,</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loadMsg:'</span><span style="font-family:宋体;background:white;">数据加载中</span><span style="background:white;">...' ,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; columns:[[</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {title:'</span><span style="font-family:宋体;background:white;">标题</span><span style="background:white;">', field:'title',width:200,formatter: <strong><span style="color:#7F0055;">function</span></strong>(value,row,index){</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return </span></strong>'&lt;span</span> style=&quot;white-space: nowrap;&quot;<span style="background:white;"> title='+value+'&gt;'+ (value?value:'')+ '&lt;/span&gt;'; </span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }},</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {title:'</span><span style="font-family:宋体;background:white;">发布时间</span><span style="background:white;">', field:'tjdate',width:100},</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {title:'</span><span style="font-family:宋体;background:white;">操作</span><span style="background:white;">', field:'hitnum',width:100, formatter: <strong><span style="color:#7F0055;">function</span></strong>(value,row,index){</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var </span></strong>p=<span style="color:#2A00FF;">&quot;&lt;ahref=\&quot;javascript:editNews('&quot;</span>+row.id+<span style="color:#2A00FF;">&quot;')\&quot;&gt;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">修改</span><span style="color:#2A00FF;background:white;">&lt;/a&gt;&quot;</span><span style="background:white;">;</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; p+=<span style="color:#2A00FF;">&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;ahref=\&quot;javascript:delNews('&quot;</span>+row.id+<span style="color:#2A00FF;">&quot;','&quot;</span>+row.title+<span style="color:#2A00FF;">&quot;')\&quot;&gt;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">删除</span><span style="color:#2A00FF;background:white;">&lt;/a&gt;&quot;</span><span style="background:white;">;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return </span></strong>p;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }}</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ]],</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; toolbar:'#tb'</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">}</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">function </span></strong><span style="background:white;">editNews(id){</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp; parent.swNewTab(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">修改新闻信息</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;${ctxPath}/news/goEdit?id=&quot;</span>+id);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">}</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">function </span></strong><span style="background:white;">delNews(newsid,title0){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; id=newsid;title=title0;</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.confirm(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">, <span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">您确认要删除</span><span style="color:#2A00FF;background:white;">“&quot;</span><span style="background:white;">+title+<span style="color:#2A00FF;">&quot;”</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">吗？</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">, <strong><span style="color:#7F0055;">function</span></strong>(r){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if </span></strong>(r){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $.ajax({</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url:<span style="color:#2A00FF;">&quot;${ctxPath}/news/doDel1&quot;</span>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data:{<span style="color:#2A00FF;">&quot;id&quot;</span>:id},</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type:<span style="color:#2A00FF;">&quot;post&quot;</span>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success:<strong><span style="color:#7F0055;">function</span></strong>(res){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(res==<span style="color:#2A00FF;">&quot;true&quot;</span>){</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">您已删除新闻：</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">+title, <span style="color:#2A00FF;">&quot;info&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; id=<span style="color:#2A00FF;">&quot;&quot;</span>;s_name=<span style="color:#2A00FF;">&quot;&quot;</span>;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loadGrid();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<strong><span style="color:#7F0055;">else </span></strong>{</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,res,<span style="color:#2A00FF;">&quot;error&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return false</span></strong>;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error:<strong><span style="color:#7F0055;">function</span></strong>(res){</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统错误</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;error&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; })</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">}</span></span></p><p><span style="font-size:18px;">&nbsp;</span></p><p><span style="background:white;"><span style="font-size:18px;">$(<strong><span style="color:#7F0055;">function</span></strong>(){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; loadGrid();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#s_news&quot;</span>).click(<strong><span style="color:#7F0055;">function</span></strong>(){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; s_name=$(<span style="color:#2A00FF;">&quot;#s_name&quot;</span>).val();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; loadGrid();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#tb&quot;</span>).bind(<span style="color:#2A00FF;">&quot;keydown&quot;</span>,<strong><span style="color:#7F0055;">function</span></strong>(e){&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var </span></strong>theEvent = e || window.event; <span style="color:#3F7F5F;">// </span></span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var</span></strong><span style="background:white;">code = theEvent.keyCode || theEvent.which ||theEvent.charCode;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if </span></strong>(code == 13) { </span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#s_news&quot;</span>).click();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">})</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">我们可以设置进入后台管理页面后，默认打开后台新闻列表</span>tab<span style="font-family:宋体;">选项卡，只需在</span>admin.html<span style="font-family:宋体;">页面中添加以下</span>JS<span style="font-family:宋体;">代码。</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">$(<strong>function</strong>(){</span></span></p><p><span style="font-size:18px;"><span style="color:#444444;">swNewTab(</span><span style="color:#880000;">'</span><span style="font-family:宋体;color:#880000;">新闻管理</span><span style="color:#880000;">'</span><span style="color:#444444;">,</span><span style="color:#880000;">&quot;${ctxPath}/news/goList&quot;</span><span style="color:#444444;">);</span></span></p><p><span style="color:#444444;"><span style="font-size:18px;">});</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;</span></span></p> </td>
        </tr>
        <tr>
          <td class="col0">2.百度编辑器</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">添加或修改新闻时，实际上不限于纯文字的发布和修改，通常需要上传图片、视频或者其它文件，需要呈现图文混排的多样性，所以使用普通的</span>textarea<span style="font-family:宋体;">满足不了需求。通常采用在线编辑器，我们选用百度</span>UEditor<span style="font-family:宋体;">富文本</span>web<span style="font-family:宋体;">编辑器，最主要的理由是：开源免费，功能丰富。</span></span></p><p><span style="font-size:18px;">UEditor <span style="font-family:宋体;">是一套开源的在线</span>HTML<span style="font-family:宋体;">编辑器，主要用于让用户在网站上获得所见即所得编辑效果，开发人员可以用</span> UEditor <span style="font-family:宋体;">把传统的多行文本输入框</span>(textarea)<span style="font-family:宋体;">替换为可视化的富文本输入框，涵盖流行富文本编辑器特色功能，独创多种全新编辑操作模式，屏蔽各种浏览器之间的差异。</span>UEditor <span style="font-family:宋体;">使用</span> JavaScript <span style="font-family:宋体;">编写，可以无缝地与</span> Java<span style="font-family:宋体;">、</span>.NET<span style="font-family:宋体;">、</span>PHP<span style="font-family:宋体;">、</span>ASP <span style="font-family:宋体;">等程序集成，比较适合在</span>CMS<span style="font-family:宋体;">、商城、论坛、博客、</span>Wiki<span style="font-family:宋体;">、电子邮件等互联网应用上使用。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>1<span style="font-family:宋体;">）获取资源：可以从官网下载</span>1.4.3.3-UTF8-Jsp<span style="font-family:宋体;">版本</span><span style="font-family:宋体;">完整安装包</span><span style="font-family:宋体;">。如图</span>3-39<span style="font-family:宋体;">所示是</span>Ueditor1.4.3.3 Jsp <span style="font-family:宋体;">版本压缩包内容。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_058.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-39 Ueditor1.4.3.3 Jsp <span style="font-family:宋体;">版本压缩包内容</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>2<span style="font-family:宋体;">）安装资源：</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">u<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">将下载的资源包，解压缩，重命名父级文件夹，如</span>ueditor<span style="font-family:宋体;">，放入</span>include<span style="font-family:宋体;">文件夹中。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_059.png}" alt="" /><img src="http://10.1.13.252:8080/exam/include/xheditor/xheditor_skin/blank.gif" class="wordImage" width="195" height="140" alt="" /><img src="http://10.1.13.252:8080/exam/include/xheditor/xheditor_skin/blank.gif" class="wordImage" width="208" height="236" alt="" />&nbsp;</span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-40<span style="font-family:宋体;">安装</span>ueditor<span style="font-family:宋体;">资源到当前项目</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">u<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">将包中</span>ueditor1_4_3_3-utf8-jsp\ueditor\jsp\lib<span style="font-family:宋体;">里面的</span>*.jar<span style="font-family:宋体;">和</span>ueditor1.5.0.jar<span style="font-family:宋体;color:red;">（已在3.8.8中修改并导出）</span><span style="font-family:宋体;">放入</span>WEB-INF\lib<span style="font-family:宋体;">文件夹中。这一项工作，也许在</span>3.2.3<span style="font-family:宋体;">节中已经完成了。</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">u<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">将包中</span>jsp<span style="font-family:宋体;">里面的</span>config.json<span style="font-family:宋体;">放入</span>conf<span style="font-family:宋体;">文件夹中。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>3<span style="font-family:宋体;">）修改配置：</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>WebRoot<span style="font-family:宋体;">目录下创建的文件夹</span>upload<span style="font-family:宋体;">作为指定存放上传文件的目录。</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">修改</span>ueditor.config.js<span style="font-family:宋体;">文件</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">指定服务器上响应文件上传的方法，其中</span>base<span style="font-family:宋体;">为当前项目</span>path<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;">serverUrl: base+<span style="color:#2A00FF;">&quot;file/bdupfile&quot;</span>,</span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">修改</span>config.json<span style="font-family:宋体;">文件</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">把原始文件中所有默认的上传保存路径</span>/ueditor/jsp/upload/…<span style="font-family:宋体;">全部修改为当前项目设计的路径前缀</span>/upload/…<span style="font-family:宋体;">，例如，图片的上传保存路径修改为：</span></span></p><p><span style="font-size:18px;"><span style="color:green;">&quot;imagePathFormat&quot;</span>: <span style="color:#2A00FF;">&quot;/upload/image/{yyyy}{mm}{dd}/{time}{rand:6}&quot;</span>,</span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>4<span style="font-family:宋体;">）使用样例：</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span><strong><span style="color:#7F0055;">var </span></strong>base=<span style="color:#2A00FF;">&quot;${ctxPath}/&quot;</span>;<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p> <span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em><span style="color:#7F007F;">charset</span>=<em><span style="color:#2A00FF;">&quot;utf-8&quot;</span></em><span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/ueditor/ueditor.config.js&quot;</span></em><span style="color:teal;">&gt; &lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p> <span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em> <span style="color:#7F007F;">charset</span>=<em><span style="color:#2A00FF;">&quot;utf-8&quot;</span></em><span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/ueditor/ueditor.all.min.js&quot;</span></em><span style="color:teal;">&gt;</span> <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p> <span style="font-size:18px;"><span style="color:#3F5FBF;">&lt;!--</span><span style="font-family:宋体;color:#3F5FBF;">建议手动加在语言，避免在</span><span style="color:#3F5FBF;">ie</span><span style="font-family:宋体;color:#3F5FBF;">下有时因为加载语言失败导致编辑器加载失败</span><span style="color:#3F5FBF;">--&gt;</span></span></p><p> <span style="font-size:18px;"><span style="color:#3F5FBF;">&lt;!--</span><span style="font-family:宋体;color:#3F5FBF;">这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文</span><span style="color:#3F5FBF;">--&gt;</span></span></p><p> <span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em><span style="color:#7F007F;">charset</span>=<em><span style="color:#2A00FF;">&quot;utf-8&quot;</span></em><span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/ueditor/lang/zh-cn/zh-cn.js&quot;</span></em><span style="color:teal;">&gt; &lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p> <span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;editor&quot;</span></em> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/plain&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">100%</span></em>;<span style="color:#7F007F;">height</span>:<em><span style="color:#2A00E1;">500px</span></em>;&quot;<span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#3F7F5F;">//</span></span><span style="font-family:宋体;color:#3F7F5F;background:white;">实例化编辑器</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">&nbsp;&nbsp;&nbsp;&nbsp; var </span></strong><span style="background:white;">ue = UE.getEditor('editor');</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">更多使用方法，请查看</span>UEditor<span style="font-family:宋体;">文档。</span></span></p><p><span style="font-size:18px;">1)<span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">可能存在的问题：</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">百度编辑器需要的</span>jar<span style="font-family:宋体;">包有问题。</span>WEB-INF\lib<span style="font-family:宋体;">中缺少需要的</span>jar<span style="font-family:宋体;">包（</span>commons-codec-1.9.jar<span style="font-family:宋体;">、</span>commons-fileupload-1.3.1.jar<span style="font-family:宋体;">、</span>commons-io-2.4.jar<span style="font-family:宋体;">、</span>json.jar<span style="font-family:宋体;">、</span>ueditor-xxx.jar<span style="font-family:宋体;">），或者存在重复</span>jar<span style="font-family:宋体;">包，只是版本号不同，或者只有太旧的版本。</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">配置文件的物理路径有问题。比如</span>tomcat<span style="font-family:宋体;">的路径上有空格，或者有中文，运行项目后，配置文件生成到</span>tomcat<span style="font-family:宋体;">的</span>webapps<span style="font-family:宋体;">中，但由于</span>tomcat<span style="font-family:宋体;">的安装路径有特殊字符，导致</span>ueditor<span style="font-family:宋体;">不能正常读取</span>config.json<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">配置文件的编码有问题。确保</span>config.json<span style="font-family:宋体;">文件的编码方式</span>utf-8<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><span style="font-family:宋体;">配置文件的内容有问题。</span>config.json<span style="font-family:宋体;">文件中不能出现“</span>//<span style="font-family:宋体;">”注释符。</span></span></p>  </td>
        </tr>
        <tr>
          <td class="col0">3.添加新闻</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">准备好了</span>ueditor<span style="font-family:宋体;">编辑器，则可以在添加和修改新闻时，采用</span>ueditor<span style="font-family:宋体;">实现图片、动画、附件、视频等文件上传，实现在线图文混排。</span></span></p><p><span style="font-family:宋体;"><span style="font-size:18px;">添加新闻，也是发布新闻的一个基本操作，教学过程中，已经简化了部分功能，忽略了发布时需要选择新闻版块、是否图片新闻、是否置顶等功能。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>WebRoot\WEB-INF\web<span style="font-family:宋体;">中创建</span><strong>newsadd.html</strong><span style="font-family:宋体;">页面，实现新闻的前端添加发布，页面效果如图</span>3-41<span style="font-family:宋体;">所示。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_060.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-41<span style="font-family:宋体;">添加新闻窗口</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>1<span style="font-family:宋体;">）引用文件：</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">link</span> <span style="color:#7F007F;">rel</span>=<em><span style="color:#2A00FF;">&quot;stylesheet&quot;</span></em> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/css&quot;</span></em><span style="color:#7F007F;">href</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/easyui/themes/default/easyui.css&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">link</span> <span style="color:#7F007F;">rel</span>=<em><span style="color:#2A00FF;">&quot;stylesheet&quot;</span></em> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/css&quot;</span></em><span style="color:#7F007F;">href</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/easyui/themes/icon.css&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;</span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/js/jquery.min.js&quot;</span></em><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em> <span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/easyui/jquery.easyui.min.js&quot;</span></em><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em> <span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/easyui/locale/easyui-lang-zh_CN.js&quot;</span></em><span style="color:teal;">&gt; &lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span><strong><span style="color:#7F0055;">var </span></strong>base=<span style="color:#2A00FF;">&quot;${ctxPath}/&quot;</span>;<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em> <span style="color:#7F007F;">charset</span>=<em><span style="color:#2A00FF;">&quot;utf-8&quot;</span></em><span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/ueditor/ueditor.config.js&quot;</span></em><span style="color:teal;">&gt; &lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em> <span style="color:#7F007F;">charset</span>=<em><span style="color:#2A00FF;">&quot;utf-8&quot;</span></em><span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/ueditor/ueditor.all.min.js&quot;</span></em><span style="color:teal;">&gt;</span> <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/javascript&quot;</span></em> <span style="color:#7F007F;">charset</span>=<em><span style="color:#2A00FF;">&quot;utf-8&quot;</span></em><span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/ueditor/lang/zh-cn/zh-cn.js&quot;</span></em><span style="color:teal;">&gt; &lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>2<span style="font-family:宋体;">）页面主要代码：</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">对应新闻对象的主要属性，其中新闻</span>id<span style="font-family:宋体;">和新闻的发布时间由后端生成，不需要前端输入，所以前端仅提供了新闻标题、新闻内容和新闻发布人的输入，另加一个保存按钮。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;easyui-panel&quot;</span></em><span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">padding</span>:<em><span style="color:#2A00E1;">5px 2px</span></em>&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">form</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">table</span> <span style="color:#7F007F;">cellpadding</span>=<em><span style="color:#2A00FF;">&quot;5&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">100px</span></em>;&quot;<span style="color:teal;">&gt;</span><span style="font-family:宋体;">新闻标题：</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span><span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">880px</span></em>;&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">input</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;title&quot;</span></em> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;easyui-textbox&quot;</span></em> <span style="color:#7F007F;">data-options</span>=<em><span style="color:#2A00FF;">&quot;prompt:'</span><span style="font-family:宋体;color:#2A00FF;">新闻标题</span><span style="color:#2A00FF;">', required:true&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">90%</span></em>;<span style="color:#7F007F;">height</span>:<em><span style="color:#2A00E1;">32px</span></em>&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;</span><span style="font-family:宋体;">新闻发布者：</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">input</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;cruser&quot;</span></em> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;easyui-textbox&quot;</span></em> <span style="color:#7F007F;">value</span>=<em><span style="color:#2A00FF;">&quot;${me.xm}&quot;</span></em><span style="color:#7F007F;">data-options</span>=<em><span style="color:#2A00FF;">&quot;prompt:'</span><span style="font-family:宋体;color:#2A00FF;">发布人</span><span style="color:#2A00FF;">', required:true&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">90%</span></em>;<span style="color:#7F007F;">height</span>:<em><span style="color:#2A00E1;">32px</span></em>&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">vertical-align</span>: <em><span style="color:#2A00E1;">top</span></em>;&quot;<span style="color:teal;">&gt;</span><span style="font-family:宋体;">新闻内容：</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;content&quot;</span></em> <span style="color:#7F007F;">type</span>=<em><span style="color:#2A00FF;">&quot;text/plain&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">89%</span></em>;<span style="color:#7F007F;">height</span>:<em><span style="color:#2A00E1;">300px</span></em>;&quot;<span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">table</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">form</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">text-align</span>:<em><span style="color:#2A00E1;">center</span></em>;&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">a</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;savenews&quot;</span></em> <span style="color:#7F007F;">href</span>=<em><span style="color:#2A00FF;">&quot;#&quot;</span></em> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;easyui-linkbutton&quot;</span></em> <span style="color:#7F007F;">iconCls</span>=<em><span style="color:#2A00FF;">&quot;icon-ok&quot;</span></em><span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">width</span>:<em><span style="color:#2A00E1;">132px</span></em>;<span style="color:#7F007F;">height</span>:<em><span style="color:#2A00E1;">32px</span></em>&quot;<span style="color:teal;">&gt;</span><span style="font-family:宋体;">保存</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">a</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">（</span>3<span style="font-family:宋体;">）主要</span>JS<span style="font-family:宋体;">代码：</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">实现百度编辑器的创建；新增新闻信息的校验和通过</span>ajax<span style="font-family:宋体;">向后端提交。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">var </span></strong><span style="background:white;">ue;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">$(<strong><span style="color:#7F0055;">function</span></strong>(){</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; ue = UE.getEditor('content');</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp; $('#savenews').click(<strong><span style="color:#7F0055;">function</span></strong>(){<span style="color:#3F7F5F;">//</span></span><span style="font-family:宋体;color:#3F7F5F;background:white;">发布新闻前，要校验</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var </span></strong><span style="background:white;">a=$(<span style="color:#2A00FF;">&quot;#title&quot;</span>).textbox(<span style="color:#2A00FF;">&quot;getValue&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var </span></strong>b=ue.getContent();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var </span></strong>c=$(<span style="color:#2A00FF;">&quot;#cruser&quot;</span>).textbox(<span style="color:#2A00FF;">&quot;getValue&quot;</span>);</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(a.length&lt;=0){$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">必须填写新闻标题</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;warning&quot;</span>); <strong><span style="color:#7F0055;">return</span></strong>;}</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(b.length&lt;=0){$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">必须填写新闻内容</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;warning&quot;</span>); <strong><span style="color:#7F0055;">return</span></strong>;}</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(c.length&lt;=0){$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">必须填写发布人姓名或者发布机构名称</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;warning&quot;</span>); <strong><span style="color:#7F0055;">return</span></strong>;}</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $.ajax({</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type:'POST',</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url: <span style="color:#2A00FF;">&quot;${ctxPath}/news/saveAdd&quot;</span>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data: {<span style="color:#2A00FF;">&quot;title&quot;</span>:a,<span style="color:#2A00FF;">&quot;content&quot;</span>:b,<span style="color:#2A00FF;">&quot;cruser&quot;</span>:c},</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success: <strong><span style="color:#7F0055;">function </span></strong>(res) { </span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(res==<span style="color:#2A00FF;">&quot;true&quot;</span>){</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">你已添加新闻</span><span style="color:#2A00FF;background:white;">:&quot;</span><span style="background:white;">+ $(<span style="color:#2A00FF;">&quot;#title&quot;</span>).val(),<span style="color:#2A00FF;">&quot;info&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<strong><span style="color:#7F0055;">else</span></strong>{</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">添加失败！</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">, <span style="color:#2A00FF;">&quot;error&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return false</span></strong>;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error: <strong><span style="color:#7F0055;">function</span></strong>(res){parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统错误！</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">, <span style="color:#2A00FF;">&quot;error&quot;</span>); }</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">});</span></span></p>  </td>
        </tr>
        <tr>
          <td class="col0">4.删除新闻</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">在软件系统中，进行“删除”操作，都有确认步骤，在一定程度上防止不小心误删，如图</span>3-42<span style="font-family:宋体;">所示。删除操作之后，通常会有删除成功或删除失败之类的提示信息。相关实现功能的</span>JS<span style="font-family:宋体;">代码，已在“后台新闻列表”中给出。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_061.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-42<span style="font-family:宋体;">删除新闻</span></span></p>  </td>
        </tr>
        <tr>
          <td class="col0">5.修改新闻</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>WebRoot\WEB-INF\web<span style="font-family:宋体;">中创建</span><strong>newsedit.html</strong><span style="font-family:宋体;">页面，新闻修改页</span>newsedit.html<span style="font-family:宋体;">的内容与新闻添加页基本相同，如页面中最主要的部分是对应</span>news<span style="font-family:宋体;">对象各种属性的输入框；不相同的部分主要体现在：</span></span></p><p><span style="font-size:18px;">(1)<span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">页面中使用</span>${news.xxx}<span style="font-family:宋体;">接收后端返回的一条新闻</span>news<span style="font-family:宋体;">的各种属性值，页面效果如图</span>3-42<span style="font-family:宋体;">所示。</span></span></p><p><span style="font-size:18px;">(2)<span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">请求保存的路径不一样</span></span></p><p><span style="font-size:18px;">(3)<span style="font-family: Times New Roman;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="font-family:宋体;">操作结果的提示信息有区别</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_062.png}" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-43<span style="font-family:宋体;">修改新闻窗口</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">主要</span>JS<span style="font-family:宋体;">代码，实现创建百度编辑器、动态加载指定</span>id<span style="font-family:宋体;">新闻信息、校验后保存修改的信息。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">var </span></strong><span style="background:white;">ue;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">$(<strong><span style="color:#7F0055;">function</span></strong>(){</span></span></p><p><span style="background:white;"><span style="font-size:18px;"> ue =UE.getEditor('content');</span></span></p><p><span style="background:white;"><span style="font-size:18px;"> $(<span style="color:#2A00FF;">&quot;#title&quot;</span>).textbox(<span style="color:#2A00FF;">&quot;setValue&quot;</span>,<span style="color:#2A00FF;">&quot;${news.title}&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;"> ue.ready(<strong><span style="color:#7F0055;">function</span></strong>() {</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ue.setContent(<span style="color:#2A00FF;">&quot;&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ue.execCommand('insertHtml','${news.content}');</span></span></p><p><span style="background:white;"><span style="font-size:18px;"> });</span></span></p><p><span style="background:white;"><span style="font-size:18px;"> $(<span style="color:#2A00FF;">&quot;#cruser&quot;</span>).textbox(<span style="color:#2A00FF;">&quot;setValue&quot;</span>,<span style="color:#2A00FF;">&quot;${news.cruser}&quot;</span>);</span></span></p><p><span style="font-size:18px;"><span style="background:white;"> $('#savenews').click(<strong><span style="color:#7F0055;">function</span></strong>(){<span style="color:#3F7F5F;">//</span></span><span style="font-family:宋体;color:#3F7F5F;background:white;">发布新闻前，要校验</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var </span></strong><span style="background:white;">a=$(<span style="color:#2A00FF;">&quot;#title&quot;</span>).textbox(<span style="color:#2A00FF;">&quot;getValue&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var </span></strong>b=ue.getContent();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var </span></strong>c=$(<span style="color:#2A00FF;">&quot;#cruser&quot;</span>).textbox(<span style="color:#2A00FF;">&quot;getValue&quot;</span>);</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(a.length&lt;=0){$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">必须填写新闻标题</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;warning&quot;</span>);<strong><span style="color:#7F0055;">return</span></strong>;}</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(b.length&lt;=0){$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">必须填写新闻内容</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;warning&quot;</span>);<strong><span style="color:#7F0055;">return</span></strong>;}</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(c.length&lt;=0){$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">必须填写发布人姓名或者发布机构名称</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;warning&quot;</span>);<strong><span style="color:#7F0055;">return</span></strong>;}</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $.ajax({</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type:'POST',</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url: <span style="color:#2A00FF;">&quot;${ctxPath}/news/saveEdit&quot;</span>,</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data: {<span style="color:#2A00FF;">&quot;title&quot;</span>:a,<span style="color:#2A00FF;">&quot;content&quot;</span>:b,<span style="color:#2A00FF;">&quot;cruser&quot;</span>:c,<span style="color:#2A00FF;">&quot;id&quot;</span>:${news.id}},</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success: <strong><span style="color:#7F0055;">function </span></strong>(res) { </span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(res==<span style="color:#2A00FF;">&quot;true&quot;</span>){</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">你已修改新闻</span><span style="color:#2A00FF;background:white;">:&quot;</span><span style="background:white;">+ $(<span style="color:#2A00FF;">&quot;#title&quot;</span>).val(), <span style="color:#2A00FF;">&quot;info&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<strong><span style="color:#7F0055;">else</span></strong>{</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">修改失败！</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;error&quot;</span>);</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">return false</span></strong>;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</span></span></p><p><span style="font-size:18px;"><span style="background:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error: <strong><span style="color:#7F0055;">function</span></strong>(res){parent.$.messager.alert(<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统提示</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;</span></span><span style="font-family:宋体;color:#2A00FF;background:white;">系统错误！</span><span style="color:#2A00FF;background:white;">&quot;</span><span style="background:white;">,<span style="color:#2A00FF;">&quot;error&quot;</span>);}</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; });</span></span></p><p><span style="background:white;"><span style="font-size:18px;"> });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">});</span></span></p>  </td>
        </tr>
        <tr>
          <td class="col0">3.8.10 前台新闻信息处理</td>
          <td class="col1">000</td>
        </tr>
        <tr>
          <td class="col0">1.新闻列表</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">教学中简单化处理，修改系统首页</span>index.html<span style="font-family:宋体;">，使其既有登录功能，还可以查看新闻列表，如图</span>3-44<span style="font-family:宋体;">所示。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_063.png}" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-44<span style="font-family:宋体;">前台新闻列表</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">仍然要处理过长的标题显示效果。新闻标题过长时可以自动截断，并在末尾显示</span>“…”<span style="font-family:宋体;">，避免太长的标题破坏页面外观效果。加载新闻列表时，通常只显示标题和发布日期。新闻条目较多时，通常采用分页控件实现分页效果，继续使用</span>easyui<span style="font-family:宋体;">的控件，如</span>pagination<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">页面仍然使用</span>ajax<span style="font-family:宋体;">技术实现动态加载新闻列表。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">以下是</span>index.html<span style="font-family:宋体;">页面添加的用于显示新闻列表的主要代码，没有提供</span>css<span style="font-family:宋体;">文件，请大家发挥各自的能力，设计实现自己特色（样式）的新闻列表页。</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;lnews&quot;</span></em> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;l-wrap&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;l-news&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;nheader&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">table</span> <span style="color:#7F007F;">cellspacing</span>=<em><span style="color:#2A00FF;">&quot;0&quot;</span></em> <span style="color:#7F007F;">cellpadding</span>=<em><span style="color:#2A00FF;">&quot;0&quot;</span></em><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">tbody</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">h3</span><span style="color:teal;">&gt;</span><span style="font-family:宋体;">通知新闻：</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">h3</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">tbody</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">table</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;nlist&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">table</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;newstable&quot;</span></em> <span style="color:#7F007F;">width</span>=<em><span style="color:#2A00FF;">&quot;100%&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">tbody</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">tr</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;trpp&quot;</span></em><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">td</span> <span style="color:#7F007F;">colspan</span>=<em><span style="color:#2A00FF;">&quot;2&quot;</span></em><span style="color:teal;">&gt;</span> <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">td</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">tr</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">tbody</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">table</span><span style="color:teal;">&gt;</span> </span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;pp&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">background</span>:<em><span style="color:#2A00E1;">#efefef</span></em>;&quot;<span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">为了让登录窗口、新闻列表分别显示，可以在页面</span>body<span style="font-family:宋体;">里面加超链接，实现简单的切换。</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">float</span>:<em><span style="color:#2A00E1;">right</span></em>;<span style="color:#7F007F;">padding-right</span>:<em><span style="color:#2A00E1;">20px</span></em>;&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">a</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;a&quot;</span></em> <span style="color:#7F007F;">href</span>=<em><span style="color:#2A00FF;">&quot;#&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">margin-right</span>:<em><span style="color:#2A00E1;">15px</span></em>;&quot;<span style="color:teal;">&gt;</span><span style="font-family:宋体;">登录</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">a</span><span style="color:teal;">&gt;</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">a</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;b&quot;</span></em> <span style="color:#7F007F;">href</span>=<em><span style="color:#2A00FF;">&quot;#&quot;</span></em> <span style="color:teal;">&gt;</span><span style="font-family:宋体;">新闻</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">a</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">页面中实现登录与新闻列表切换、新闻列表内容的动态加载的</span>JS<span style="font-family:宋体;">代码如下。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">首先通过一个</span>ajax<span style="font-family:宋体;">，获取新闻总数</span>(pageTotal)<span style="font-family:宋体;">、加载第</span>1<span style="font-family:宋体;">页的新闻列表</span>(listNews)<span style="font-family:宋体;">、加载</span>easyui<span style="font-family:宋体;">分页器</span>(loadPager)<span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">默认隐藏登录窗口，显示新闻列表。为了能够切换登录窗口和新闻列表窗口，让超链接绑定</span>click<span style="font-family:宋体;">事件。</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;">var</span></strong> pageN=1,pageTotal=100;</span></p><p><span style="font-size:18px;">$(<strong><span style="color:#7F0055;">function</span></strong>(){ </span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $.ajax({</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url:<span style="color:#2A00FF;">&quot;./news/getCount&quot;</span>,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type:<span style="color:#2A00FF;">&quot;post&quot;</span>,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success: <strong><span style="color:#7F0055;">function</span></strong>(res){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pageTotal=parseInt(res);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; listNews(1,10);loadPager();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error:<strong><span style="color:#7F0055;">function</span></strong>(res){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $.messager.alert(<span style="color:#2A00FF;">&quot;</span><span style="font-family:宋体;color:#2A00FF;">系统提示</span><span style="color:#2A00FF;">&quot;</span>,<span style="color:#2A00FF;">&quot;</span><span style="font-family:宋体;color:#2A00FF;">系统错误</span><span style="color:#2A00FF;">&quot;</span>,<span style="color:#2A00FF;">&quot;error&quot;</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#llogin&quot;</span>).hide();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#a&quot;</span>).click(<strong><span style="color:#7F0055;">function</span></strong>(){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#llogin&quot;</span>).show();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#lnews&quot;</span>).hide();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#b&quot;</span>).click(<strong><span style="color:#7F0055;">function</span></strong>(){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#llogin&quot;</span>).hide();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#lnews&quot;</span>).show();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></p><p><span style="font-size:18px;">});</span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;">function</span></strong>listNews(pageNumber,pageSize){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $.ajax({</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; url:<span style="color:#2A00FF;">&quot;./news/listNews&quot;</span>,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; data:{<span style="color:#2A00FF;">&quot;page&quot;</span>:pageNumber,<span style="color:#2A00FF;">&quot;rows&quot;</span>:pageSize},</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type:<span style="color:#2A00FF;">&quot;post&quot;</span>,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; success: <strong><span style="color:#7F0055;">function</span></strong>(res){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;.inews&quot;</span>).remove();</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; res=JSON.parse(res);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(res.total&lt;=0){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var</span></strong>tr=<span style="color:#2A00FF;">&quot;&lt;tr class='inews'height=\&quot;25\&quot;&gt;&lt;td &gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tr+=<span style="color:#2A00FF;">&quot;&lt;div class='t'&gt;</span><span style="font-family:宋体;color:#2A00FF;">暂无相关新闻</span><span style="color:#2A00FF;">&lt;/div&gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tr+=<span style="color:#2A00FF;">&quot;&lt;/td&gt;&lt;td width='1%' nowrap=''&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#trpp&quot;</span>).before(tr);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">else</span></strong>{</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pageN=pageNumber;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pageTotal=res.total;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var</span></strong>rows=res.rows;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">for</span></strong>(<strong><span style="color:#7F0055;">var</span></strong> i=0;i&lt;rows.length;){ </span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var</span></strong> row=rows[i];</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var</span></strong> tr=<span style="color:#2A00FF;">&quot;&lt;trclass='inews' height=\&quot;25\&quot;&gt;&lt;td &gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tr+=<span style="color:#2A00FF;">&quot;&lt;div class='t'&gt;&lt;ahref='./news/getNews?id=&quot;</span>+row.id+<span style="color:#2A00FF;">&quot;'target='_blank' title='&quot;</span>+row.title+<span style="color:#2A00FF;">&quot;'&gt;&quot;</span>+row.title+<span style="color:#2A00FF;">&quot;&lt;/a&gt;&lt;/div&gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tr+=<span style="color:#2A00FF;">&quot;&lt;/td&gt;&lt;td width='1%' nowrap=''&gt;&lt;span&gt;&quot;</span>+row.tjdate.substr(0,10)+<span style="color:#2A00FF;">&quot;&amp;nbsp;&lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#trpp&quot;</span>).before(tr);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i++;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(i%5==0){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tr=<span style="color:#2A00FF;">&quot;&lt;tr class='inews' height='1'&gt;&lt;tdcolspan='2' align='center'&gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; tr+=<span style="color:#2A00FF;">&quot;&lt;hrstyle='border-style:dashed;border-color:#999999;width:99%;height:1px;border-width:1px0px 0px 0px;visibility:inherit'&gt;&lt;/td&gt;&lt;/tr&gt;&quot;</span>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">&quot;#trpp&quot;</span>).before(tr);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error:<strong><span style="color:#7F0055;">function</span></strong>(res){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parent.dlg_ok(300,140,<span style="color:#2A00FF;">&quot;</span><span style="font-family:宋体;color:#2A00FF;">系统提示</span><span style="color:#2A00FF;">&quot;</span>,<span style="color:#2A00FF;">&quot;</span><span style="font-family:宋体;color:#2A00FF;">系统错误</span><span style="color:#2A00FF;">&quot;</span>,<strong><span style="color:#7F0055;">null</span></strong>,<span style="color:#2A00FF;">&quot;error&quot;</span>);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; })</span></p><p><span style="font-size:18px;">}</span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;">function</span></strong> loadPager(){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $(<span style="color:#2A00FF;">'#pp'</span>).pagination({</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; total:pageTotal,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pageSize:10,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pageNumber:pageN,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; displayMsg:<span style="color:#2A00FF;">'{from}/{to} </span><span style="font-family:宋体;color:#2A00FF;">共</span><span style="color:#2A00FF;">{total}</span><span style="font-family:宋体;color:#2A00FF;">条</span><span style="color:#2A00FF;">'</span>,</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; onSelectPage:<strong><span style="color:#7F0055;">function</span></strong>(pageNumber,pageSize){</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; listNews(pageNumber,pageSize);</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; });</span></p><p><span style="font-size:18px;">}</span></p>  </td>
        </tr>
        <tr>
          <td class="col0">2.新闻阅读</td>
          <td class="col1"><p><span style="font-size:18px;"><span style="font-family:宋体;">在</span>WebRoot\WEB-INF\web<span style="font-family:宋体;">中创建新闻阅读页</span><strong>newsread.html</strong><span style="font-family:宋体;">，用于展示一条新闻的内容，新闻阅读页的内容通常包括：新闻标题、新闻主体内容（图、文、附件链接</span>…<span style="font-family:宋体;">）、日期、来源（发布人或机构）、阅读量，如图</span>3-45<span style="font-family:宋体;">所示。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">为了防止新闻发布时间显示不正常，使用了</span>Beetl<span style="font-family:宋体;">方法简单转换了日期格式</span><strong>${news.tjdate,dateFormat=“yyyy-MM-dd”}</strong><span style="font-family:宋体;">。</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">页面中增加了</span>2<span style="font-family:宋体;">个小小的功能：</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><strong><span style="font-family:宋体;">关闭窗口</span></strong><span style="font-family:宋体;">，实际上是关闭当前页面。</span></span></p><p><span style="font-size:18px;"><span style="font-family:Wingdings;">l<span style="font-family: Times New Roman;">&nbsp; </span></span><strong><span style="font-family:宋体;">返回顶部</span></strong><span style="font-family:宋体;">。如果新闻内容很长，当向下滑动一段距离后，则自动显示</span>“<span style="font-family:宋体;">返回顶部</span>”<span style="font-family:宋体;">的功能。返回顶部的方法有很多种，比如使用</span>jquery.toTop.min.js<span style="font-family:宋体;">也可以实现返回顶部不一样的效果。</span></span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_064.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-45<span style="font-family:宋体;">新闻阅读</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">页面主要</span>html<span style="font-family:宋体;">代码如下，没有提供</span>CSS<span style="font-family:宋体;">代码，请发挥各自能力，实现有特色的新闻阅读页面。</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">background</span>:<em><span style="color:#2A00E1;">#B3DFDA</span></em>;<span style="color:#7F007F;">padding</span>:<em><span style="color:#2A00E1;">0 10px 0 10px</span></em>;<span style="color:#7F007F;">vertical-align</span>:<em><span style="color:#2A00E1;">middle</span></em>;&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">img</span> <span style="color:#7F007F;">src</span>=<em><span style="color:#2A00FF;">&quot;${ctxPath}/include/img/logo.png&quot;</span></em> <span style="color:#7F007F;">width</span>=<em><span style="color:#2A00FF;">&quot;126&quot;</span></em><span style="color:#7F007F;">height</span>=<em><span style="color:#2A00FF;">&quot;50&quot;</span></em><span style="color:teal;">/&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">float</span>:<em><span style="color:#2A00E1;">right</span></em>;<span style="color:#7F007F;">line-height</span>:<em><span style="color:#2A00E1;">50px</span></em>;<span style="color:#7F007F;">margin-right</span>:<em><span style="color:#2A00E1;">10px</span></em>;<span style="color:#7F007F;">font-size</span>: <em><span style="color:#2A00E1;">9pt</span></em>;&quot;<span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;<span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;</span><span style="font-family:宋体;">【</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">a</span> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">color</span>:<em><span style="color:#2A00E1;">blue</span></em>;&quot;<span style="color:#7F007F;">href</span>=<em><span style="color:#2A00FF;">&quot;javascript:window.close();&quot;</span></em><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;</span><span style="font-family:宋体;">关闭窗口</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">a</span><span style="color:teal;">&gt;&lt;</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;</span><span style="font-family:宋体;">】</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;ndetail&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;ntitle&quot;</span></em><span style="color:teal;">&gt;</span>${news.title}<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;nauthor&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span><span style="font-family:宋体;">来源</span>: <span style="color:#2A00FF;">&amp;nbsp;</span><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">strong</span><span style="color:teal;">&gt;</span>${news.cruser}<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">strong</span><span style="color:teal;">&gt;</span> <span style="color:#2A00FF;">&amp;nbsp;&amp;nbsp;</span><span style="font-family:宋体;">发布时间</span>:<span style="color:#2A00FF;">&amp;nbsp; </span><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">strong</span><span style="color:teal;">&gt;</span>${news.tjdate,dateFormat=&quot;yyyy-MM-dd&quot;}<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">strong</span><span style="color:teal;">&gt;</span><span style="color:#2A00FF;">&amp;nbsp;&amp;nbsp;</span><span style="font-family:宋体;">访问量</span>:<span style="color:#2A00FF;">&amp;nbsp;</span><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">strong</span><span style="color:teal;">&gt; </span>[<span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;</span>${news.hitnum}<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">span</span><span style="color:teal;">&gt;</span>]<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">strong</span><span style="color:teal;">&gt;&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span><span style="color:#7F007F;">class</span>=<em><span style="color:#2A00FF;">&quot;nbody&quot;</span></em><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;vsb_content&quot;</span></em><span style="color:teal;">&gt;</span> ${news.content}<span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span>%include(&quot;totop1.html&quot;){}%&gt;</span></p><p><span style="font-size:18px;"><img th:src="@{/assets/javaeeimg/Image_065.png}" alt="" /></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">图</span>3-46<span style="font-family:宋体;">返回顶部</span></span></p><p><span style="font-size:18px;"><span style="font-family:宋体;">以下为实现<strong>返回顶部</strong>的功能代码，单独创建了一个</span>totop1.html<span style="font-family:宋体;">页面中，然后使用</span>include<span style="font-family:宋体;">包含到</span>newsread.html<span style="font-family:宋体;">页面中，显示效果如图</span>3-46<span style="font-family:宋体;">所示。</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">style</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><em><span style="color:#3F7F7F;">#backtotop</span></em> {</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">width</span>: <em><span style="color:#2A00E1;">24px</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">color</span>: <em><span style="color:#2A00E1;">white</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">padding</span>: <em><span style="color:#2A00E1;">12px 0px 12px 5px</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">display</span>: <em><span style="color:#2A00E1;">none</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">position</span>: <em><span style="color:#2A00E1;">fixed</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">cursor</span>: <em><span style="color:#2A00E1;">pointer</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">text-align</span>: <em><span style="color:#2A00E1;">center</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">z-index</span>: <em><span style="color:#2A00E1;">20</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">background-color</span>: <em><span style="color:#2A00E1;">rgba(0, 188, 212, 0.65)</span></em>;</span></p><p><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:#7F007F;">border-radius</span>: <em><span style="color:#2A00E1;">12px 0px 0px 12px</span></em>;</span></p><p><span style="font-size:18px;">}</span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">style</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">div</span> <span style="color:#7F007F;">id</span>=<em><span style="color:#2A00FF;">&quot;backtotop&quot;</span></em> <span style="color:#7F007F;">style</span>=&quot;<span style="color:#7F007F;">right</span>: <em><span style="color:#2A00E1;">0px</span></em>;<span style="color:#7F007F;">display</span>: <em><span style="color:#2A00E1;">none</span></em>;&quot;<span style="color:teal;">&gt;</span><span style="font-family:宋体;">回到顶部</span><span style="color:teal;">&lt;/</span><span style="color:#3F7F7F;">div</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><span style="color:teal;">&lt;</span><span style="color:#3F7F7F;">script</span><span style="color:teal;">&gt;</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">var </span></strong><span style="background:white;">$backtotop = $('#backtotop');</span></span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">var </span></strong><span style="background:white;">toplrw = $(window).height() -$backtotop.height() - 200;</span></span></p><p><span style="font-size:18px;">&nbsp;</span></p><p><span style="font-size:18px;"><strong><span style="color:#7F0055;background:white;">function </span></strong><span style="background:white;">moveBacktotop() {</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(toplrw&lt;0)toplrw=0;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $backtotop.css({ top: toplrw,right: 0});</span></span></p><p><span style="background:white;"><span style="font-size:18px;">}</span></span></p><p><span style="font-size:18px;">&nbsp;</span></p><p><span style="background:white;"><span style="font-size:18px;">$backtotop.click(<strong><span style="color:#7F0055;">function </span></strong>() {</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $('html,body').animate({ scrollTop:0 });</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">returnfalse</span></strong>;</span></span></p><p><span style="background:white;"><span style="font-size:18px;">});</span></span></p><p><span style="background:white;"><span style="font-size:18px;">$(window).scroll(<strong><span style="color:#7F0055;">function </span></strong>() {</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">var</span></strong>windowHeight = $(window).scrollTop();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; <strong><span style="color:#7F0055;">if</span></strong>(windowHeight &gt; 200) {</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $backtotop.fadeIn();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; } <strong><span style="color:#7F0055;">else</span></strong>{</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; $backtotop.fadeOut();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">&nbsp;&nbsp;&nbsp;&nbsp; }</span></span></p><p><span style="background:white;"><span style="font-size:18px;">});</span></span></p><p><span style="font-size:18px;">&nbsp;</span></p><p><span style="background:white;"><span style="font-size:18px;">moveBacktotop();</span></span></p><p><span style="background:white;"><span style="font-size:18px;">$(window).resize(moveBacktotop);</span></span></p><p><span style="font-size:18px;"><span style="color:teal;background:white;">&lt;/</span><span style="color:#3F7F7F;background:white;">script</span><span style="color:teal;background:white;">&gt;</span></span></p>  </td>
        </tr>

		</tbody>
    </table>
<div th:include="include :: footer"></div>
</body>
</html>
